home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 9315 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.1 KB

  1. Path: homer17.u.washington.edu!sisca
  2. From: Fransisca Soerjono <sisca@u.washington.edu>
  3. Newsgroups: comp.lang.c++
  4. Subject: Help!
  5. Date: Thu, 29 Feb 1996 15:20:25 -0800
  6. Organization: University of Washington
  7. Message-ID: <Pine.A32.3.91j.960229151651.77675C-100000@homer17.u.washington.edu>
  8. NNTP-Posting-Host: homer17.u.washington.edu
  9. Mime-Version: 1.0
  10. Content-Type: TEXT/PLAIN; charset=US-ASCII
  11. NNTP-Posting-User: sisca
  12.  
  13. Anyone knows how to write a program to convert positive
  14. numbers from decimal to binary.
  15.  
  16. The program should repeatedly prompt the user to enter a number in
  17. decimal, then output the binary representation of the input.  If the
  18. input is -1, the program should exit, and if the input is any other
  19. negative number the program should print a warning but then continue
  20. to solicit input.
  21.  
  22. For example, a transcript might look like this:
  23.  
  24. Enter a decimal number (-1 to quit): 5
  25. 101
  26. Enter a decimal number (-1 to quit): -3
  27. Invalid input
  28. Enter a decimal number (-1 to quit): 13
  29. 1101
  30. Enter a decimal number (-1 to quit): -1
  31. prompt%
  32.  
  33. I'm using gcc by the way!
  34.  
  35. Thanks! :)
  36.